// Copyright information must stay intact
// AceCalendar v1.12
// Copyright NavSurf.com, 2003, all rights reserved
// http://navsurf.com
// You may not copy, emulate, clone, sell, modify, distribute, disassemble, 
// reverse engineer or transfer the software, or any portion of it.
// Any unauthorized use of the software will result in criminal and civil 
// prosecution.

function AceStyle(){ 
	this.color='#000000';
	this.backgroundColor='#FFFFFF';
	this.fontStyle='';
	this.fontWeight='';
	this.fontSize='';
	this.fontFamily='';
	this.borderWidth='1px';
	this.borderStyle='solid';
	this.borderColor='#FFFFFF';
	this.getStyle= 
		function(){
			var sRet='';
			var aName=['border-width','border-style','border-color','color','background-color','font-style','font-weight','font-size','font-family'];
			var aVal=[this.borderWidth,this.borderStyle,this.borderColor,this.color,this.backgroundColor,this.fontStyle,this.fontWeight,this.fontSize,this.fontFamily];
			for(var i=0;i<aName.length;i++){
				sRet+=aName[i]+':'+aVal[i]+';';
			}
			return sRet;
		};
};

function x06530905(str){
	var ar=new Array(str.length);
	for(var i=0;i<str.length;i++){
		ar[i]=str.charCodeAt(i);
	}
	return ar;
};

function x0584468753(ar){
	var str='';
	for(var i=0;i<ar.length;i++){
		str+=String.fromCharCode(ar[i]);
	}
	return str;
};

function AceCalendar(){
	this.id=null;
	this.formId='aceCal';
	this.formTag=true;
	this.state=[86,105,115,105,116,32,78,97,118,83,117,114,102,46,99,111,109,32,97,116,32,104,116,116,112,58,47,47,110,97,118,115,117,114,102,46,99,111,109,32,102,111,114,32,109,111,114,101,32,68,72,84,77,76,32,97,110,100,32,74,97,118,97,83,99,114,105,112,116,32,119,105,100,103,101,116,115];
	this.styles=Array(6);
	for(var i=0;i<this.styles.length;i++){
		this.styles[i]=new AceStyle();
	}
	this.yrId='yr_num';
	this.moId='mo_num';
	this.dtId='dt_num';
	this.months=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
	this.days =['M','T','W','T','F','S','S'];
	this.oDate=new Date();
	this.setAction=function(){};
	this.getDate=
		function(){
			return this.oDate.getDate();
		};
	this.getDay=
		function(){
			return this.oDate.getDay();
		};
	this.getMonth=
		function(){
			return this.oDate.getMonth();
		};
	this.getYear=
		function(){
			return this.oDate.getFullYear();
		};
	this.getString=
		function(){
			return this.oDate.toLocaleString();
		};
	this.setName=
		function(name){
			this.id=name;
		};
	this.setFieldNames=
		function(yrName,moName,dtName){
			if(yrName!=null&&yrName!=''){
				this.yrId=yrName;
			}
			if(moName!=null&&moName!=''){
				this.moId=moName;
			}
			if(dtName!=null&&dtName!=''){
				this.dtId=dtName;
			}
		};
		this.setFormName=
			function(formName,formTag){
				this.formId=formName;
				this.formTag=formTag;
			};
		this.setStyle=
			function(){
				var id;
				if(arguments.length>0){
					id=arguments[0];
				}
				if(arguments.length>1&&arguments[1]!=''){
					this.styles[id].borderColor=arguments[1];
				}
				if(arguments.length>2&&arguments[2]!=''){
					this.styles[id].backgroundColor=arguments[2];
				}
				if(arguments.length>3&&arguments[3]!=''){
					this.styles[id].color=arguments[3];
				}
				if(arguments.length>4){
					if(arguments[4]==0){
						this.styles[id].fontStyle='normal';
					} else {
						this.styles[id].fontStyle='italic';
					}
				}
				if(arguments.length>5){
					if(arguments[5]==0){
						this.styles[id].fontWeight='normal';
					} else {
						this.styles[id].fontWeight='bold';
					}
				}
			};
			this.setFont=function(){
				if(arguments.length>0&&arguments[0]!=''){
					this.styles[5].fontFamily=arguments[0];
				}
				if(arguments.length>1&&arguments[1]!=''){
					this.styles[5].fontSize=arguments[1];
				}
			};
			this.display=
				function(){
					if(!document.getElementById) return;
					if(this.id==null) return;
					var m,y,d,w;
					var yr,mth;
					var str='';
					if(arguments.length>0&&arguments[0]!='')
						this.oDate.setYear(arguments[0]);
					if(arguments.length>1&&arguments[1]!='')
						this.oDate.setMonth(arguments[1]);
					if(arguments.length>2&&arguments[2]!='')
						this.oDate.setDate(arguments[2]);
						str+='<table border="0" cellpadding="0" cellspacing="0" style="'+this.styles[5].getStyle()+'">';
						str+='<tr><td style="text-align:center;" width="100%" colspan="7" align="center" nowrap>';
						str+='<select size="1" name="'+this.moId+'" onchange="'+this.id+'.changeDate()" onkeyup="'+this.id+'.changeDate()">';
						mth=this.oDate.getMonth();
						for(m=0;m<this.months.length;m++){
							if(m==mth){
								str+='<option value="'+m+'" selected>'+this.months[m]+'</option>';
							} else {
								str+='<option value="'+m+'">'+this.months[m]+'</option>';
							}
						}
						str+='</select>';
						str+='<select size="1" name="'+this.yrId+'" onchange="'+this.id+'.changeDate()" onkeyup="'+this.id+'.changeDate()">';
						yr=this.oDate.getFullYear();
						y=yr-10;
						str+='<option value="'+y+'">'+y+' &lt;&lt;</option>';
						for(y=yr-9;y<yr+10;y++){
							if(y==yr){
								str+='<option value="'+y+'" selected>'+y+'</option>';
							} else {
								str+='<option value="'+y+'">'+y+'</option>';
							}
						}
						y=yr+10;
						str+='<option value="'+y+'">'+y+' &gt;&gt;</option>';
						str+='</select>';
						str+='<input type="hidden" name="'+this.dtId+'">';
						str+='</td></tr>';
						str+='<tr>';
						for(d=0;d<this.days.length;d++){
							str+='<td style="text-align:center;" align="center"><div style="'+this.styles[4].getStyle()+'">'+this.days[d]+'</div></td>';
						}
						str+='</tr>';
						var id;
						for(w=0;w<6;w++){
							str+='<tr>';
							for(d=0;d<this.days.length;d++){
								str+='<td style="text-align:center;" align="center">';
								str+='<a style="text-decoration:none" href="" onclick="return false;">';
								if(d==5||d==6){
									id=1;
								} else {
									id=0;
								}
								str+='<div id="'+this.id+w+d+'" style="'+this.styles[id].getStyle()+'" onclick="'+this.id+'.changeDay(this.innerHTML)">&nbsp;</div>';
								str+='</a></td>';str+='</td>';
							}
							str+='</tr>';
						}
						str+='</table>';
						document.write(str);
						this.changeDate();
						//this.displayDay();
					};
						
					this.parseDay=
						function(str){
							var re=new RegExp('\\D*(\\d+)\\D*','i');
							var arr=re.exec(str);
							if(arr!=null){
								return parseInt(arr[1]);
							} else {
								return 0;
							}
						};
					this.displayDay=
						function(){
							var day=this.oDate.getDate();
							var id;
							var oElement;document.forms[this.formId].elements[this.dtId].value=day;
							for(w=0;w<6;w++){
								for(d=0;d<7;d++){
									if(this.parseDay(document.getElementById(this.id+w+d).innerHTML)==day){
										oElement=document.getElementById(this.id+w+d);
										if(d==5||d==6){
											id=3;
										} else {
											id=2;
										}
										oElement.style.borderColor=this.styles[id].borderColor;
										oElement.style.backgroundColor=this.styles[id].backgroundColor;
										oElement.style.color=this.styles[id].color;
										oElement.style.fontWeight=this.styles[id].fontWeight;
										oElement.style.fontStyle=this.styles[id].fontStyle;
										break;
									}
								}
							}
						};
						this.changeDay=
							function(str){
								var day=this.parseDay(str);
								if(day!=0){
									this.resetDay();
									this.oDate.setDate(day);
									this.displayDay();
									this.setAction();
								}
							};
						this.resetDay=
							function(){
								var id;
								var oElement;
								for(w=0;w<6;w++){
									for(d=0;d<7;d++){
										oElement=document.getElementById(this.id+w+d);
										if(d==5||d==6){
											id=1;
										} else {
											id=0;
										}
										oElement.style.borderColor=this.styles[id].borderColor;
										oElement.style.backgroundColor=this.styles[id].backgroundColor;
										oElement.style.color=this.styles[id].color;
										oElement.style.fontWeight=this.styles[id].fontWeight;
										oElement.style.fontStyle=this.styles[id].fontStyle;
									}
								}
							};
							this.changeDate=
								function(){
									var d,w;
									var yr,mo;
									var day;
									var oDate=new Date();
									yr=document.forms[this.formId].elements[this.yrId].value;
									mo=document.forms[this.formId].elements[this.moId].value;
									this.oDate.setYear(yr);
									this.oDate.setMonth(mo);
									oDate.setYear(yr);
									oDate.setMonth(mo);
									for(w=0;w<6;w++){
										for(d=0;d<7;d++){
											document.getElementById(this.id+w+d).innerHTML='&nbsp;';
										}
									}
									this.resetDay();
									for(w=0,d=1;d<=31;d++){
										oDate.setDate(d);
										if(d!=oDate.getDate())
										break;
										day=oDate.getDay();
										if(day==0){
											day=6;
										} else { 
											day=day-1;
										}
										document.getElementById(this.id+w+day).innerHTML=d;
										if(day==6)
										w++;
									}
									this.displayDay();
									this.setAction();
									this.changeYear(oDate.getFullYear());
								};
							this.changeYear=
								function(yr){
									var oElement=document.forms[this.formId].elements[this.yrId];
									var oOption;
									var y;
									if(oElement.selectedIndex==0||oElement.selectedIndex==20){
										while(oElement.length>=1){
											oElement.options[0]=null;
										}
										y=yr-10;
										oOption=new Option(y+' <<',y);
										oElement.options[oElement.length]=oOption;
										for(y=yr-9;y<yr+10;y++){
											oOption=new Option(y,y);
											oElement.options[oElement.length]=oOption;
										}
										y=yr+10;
										oOption=new Option(y+' >>',y);
										oElement.options[oElement.length]=oOption;
										oElement.selectedIndex=10;
									}
								};
							}